<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>首页</title>
<link href="css/bootstrap.min.css" type="text/css" rel="stylesheet" />
<link href="css/base.css" type="text/css" rel="stylesheet" />
<link href="css/main.css" type="text/css" rel="stylesheet" />
<script src="js/jquery.js"></script>
</head>
<body>
<!--header-->
<header class="container clearfix">
	<a href="#" class="fl logo"><img src="images/logo.png"></a>
    <ul class="navPc fr hidden-xs clearfix">
    	<li class="current"><a href="index.html">网站首页</a></li>
    	<li><span>|</span></li>
    	<li><a href="article.html">文章详细</a></li>
    	<li><span>|</span></li>
    	<li><a href="about.html">关于我</a></li>
    	<!-- <li><span>|</span></li>
    	<li><a href="#">作品案例</a></li>
    	<li><span>|</span></li>
    	<li><a href="#">免费模版</a></li> -->
    </ul>
    <i class="navBtn glyphicon glyphicon-align-justify fr" data-n="0"></i>
    <ul class="navPhone">
    	<li><a href="index.html">网站首页</a></li>
    	<li><a href="article.html">文章详细</a></li>
    	<li><a href="about.html">关于我</a></li>
    	<!-- <li><a href="#">作品案例</a></li>
    	<li><a href="#">免费模版</a></li> -->
    </ul>
</header>
<!--/header-->
<!--main-->
<section class="container main clearfix">
	<div class="row">
        <div class="con fl">
        	<!--左边内容-->
            <ul class="arcList">
                <!-- <li>
                	<div class="date"><b>14</b><span>12</span></div>
                    <div class="details clearfix">
                    	<h2><a href="#">两位美女创办的男人版大众点评网</a></h2>
                        <span>作者：admin 浏览：158次</span>
                        <a href="#" class="img"><img class="img-responsive aligncenter" src="images/1-131214233524592-lp.jpg"></a>
                        <p>不久前，在华纳兄弟当助理的亚历山德拉阿敏（Alexandra Amin）跟交往了一年的男友分手后，朋友告诉她一个免费的新应用，可以让女性用户对自己的男性Facebook好友发表匿名评论。她对我说，他那么过分，你应该在Lulu上给他打个分。阿敏说。 于是，29岁的阿敏便...</p>
                        <a class="fr more" href="#"><img src="images/more.gif"></a>
                    </div>
                </li> -->
				<script>
					var ajax=false;
					if(window.ActiveXObject){
						ajax=new ActiveXObject('Microsoft.XMLHTTP');
					}else if(window.XMLHttpRequest){
						ajax=new XMLHttpRequest();
					}
					//接收数据
					ajax.onreadystatechange=function(){
						if(ajax.readyState==4&&ajax.status==200){
							var z=JSON.parse(ajax.responseText);
							//console.log(z);
							var str='';
							for(var q=0;q<z['recommend'].length;q++){
								$('.recommend dd a').eq(q).html(z['recommend'][q].a_title);
								$('.recommend dd a')[q].index=z['recommend'][q].a_id;//给添加属性
								$('.recommend dd a').eq(q).click(function(){
									localStorage.setItem('aid',this.index);
									location.href='article.html';
								})
								
								$('.recommend').eq(1).find('dd a').eq(q).html(z['lately'][q].a_title);
								$('.recommend').eq(1).find('dd a')[q].index=z['lately'][q].a_id;//给添加属性
								$('.recommend').eq(1).find('dd a').eq(q).click(function(){
									localStorage.setItem('aid',this.index);
									location.href='article.html';
								})
							}
							for(var i=0;i<z['art'].length;i++){
								//console.log(z['art'][i].a_title);
								
								
								
								
								
								var d=z['art'][i].a_date;
								var year=d.substr(2,2);
								var month=d.substr(5,2);
								var a_id=z['art'][i].a_id;
								// console.log(year,month);
								// $('.details h2 a').html(z[i].a_title)
								str+="<li><div class='date'><b>"+month+"</b><span>"+year+"</span></div><div class='details clearfix'><h2><a href='#'>"+z['art'][i].a_title+"</a></h2><span>作者："+z['art'][i].a_author+" 浏览："+z['art'][i].a_readnum+"次</span><a href='#' class='img'><img class='img-responsive aligncenter' src='images/"+z['art'][i].a_photo+"'></a><p>"+z['art'][i].a_intro+"...</p><a class='fr more' id='"+z['art'][i].a_id+"' href='javascript:;'><img src='images/more.gif'></a></div></li>";
								$('ul.arcList').html(str);
								
								$('ul.arcList li .more').click(function(){
									
									var aid=$(this).attr('id');
									console.log(aid);
									
									var ajax1=false;
									if(window.ActiveXObject){
										ajax1=new ActiveXObject('Microsoft.XMLHTTP');
									}else if(window.XMLHttpRequest){
										ajax1=new XMLHttpRequest();
									}
									
									ajax1.onreadystatechange=function(){
										
										if(ajax1.readyState==4&&ajax1.status==200){
											read=JSON.parse(ajax1.responseText).detailed.a_readnum;
											read=Number(read)+1;
											try{//成功
												localStorage.setItem('aid',aid);
												location.href="article.html";
											}catch{
												if(oExcapion.name=='QuotaExceededError'){
													console.log('超出本地存储限额');
													//清除失败的存储
													localStorage.clear();
												}
											}
										}
									}
									ajax1.open('post','api/data.php');
									ajax1.setRequestHeader('content-type','application/x-www-form-urlencoded');
									//ajax1.setRequestHeader('Content-Type', 'application/json');
									ajax1.send('aid='+aid+"&read=read");
									//jq ajax
									/* $.ajax({
										type:'post',
										url:'api/data.php',
										data:'aid='+aid,
										dataType:"json",
										success:function(z){
											console.log(z);
										}
									}) */
								})
							}
						}
					}
					ajax.open('post','api/data.php');
					ajax.send();
				</script>
            </ul>
        	<!--/左边内容-->
        </div>
        <aside class="fr clearfix">
        	<!--右边内容-->
            <dl>
            	<dt>推荐文章</dt>
                <div class="recommend">
                    <dd><i></i><a href="#">创业公司拉勾网：从LinkedIn到垂</a></dd>
                    <dd><i></i><a href="#">最新织梦CMS仿锐狐特效翻牌模板</a></dd>
                    <dd><i></i><a href="#">首家被Y Combinator孵化的中国团</a></dd>
                    <dd><i></i><a href="#">两位美女创办的男人版大众点评网</a></dd>
                    <dd><i></i><a href="#">最新织梦CMS仿锐狐特效翻牌模板</a></dd>
                </div>
            </dl>
            <dl>
            	<dt>最近更新</dt>
                <div class="recommend">
                    <dd><i></i><a href="#">创业公司拉勾网：从LinkedIn到垂</a></dd>
                    <dd><i></i><a href="#">最新织梦CMS仿锐狐特效翻牌模板</a></dd>
                    <dd><i></i><a href="#">首家被Y Combinator孵化的中国团</a></dd>
                    <dd><i></i><a href="#">两位美女创办的男人版大众点评网</a></dd>
                    <dd><i></i><a href="#">最新织梦CMS仿锐狐特效翻牌模板</a></dd>
                </div>
            </dl>
        	<!--/右边内容-->
        </aside>
    </div>
</section>
<!--/main-->
<!--footer-->
<footer>
	<div class="container clearfix">
        <p class="copy">
            Copyright © 2010-2016 5imoban.net<br>
            <a href="#">版权申明</a> | <a href="#">网站地图</a> | <a href="http://www.5imoban.net" target="_blank">网页</a> | <a href="#">联系合作</a><br>
            备案号：鄂ICP备8888888号-8
		</p>
    </div>
</footer>
<!--footer-->
<script>
$(function(){
	//nav
	$(".navBtn").click(function(){
		var n = $(this).data("n");
		if(n == 0){
			$(".navPhone").slideDown();
			$(this).data("n",1);
		}else{
			$(".navPhone").slideUp();
			$(this).data("n",0);
		}
	})
})
</script>
</body>
</html>
	